Trò chơi đua xe động vật trong UNITY Engine
114.961 lượt xem;
- ButtonClickListener.cs
- MainMenu /
- AnimalRacing /
- Scripts /
- Assets /
- project /
1 using UnityEngine;
2 using System.Collections;
3 using Settings;
4
5 namespace MainMenu
6 {
7 public class ButtonClickListener : InputAdapter
8 {
9 public int buttonIndex;
10
11 public SettingLayer settingLayer;
12
13 public GameObject achievementLayer;
14
15 public override void OnTouchDown()
16 {
17 if (InputController.Name == InputNames.MAINMENU)
18 {
19 transform.localScale = new Vector3(0.9f, 0.9f, transform.localPosition.z);
20 gameObject.GetComponent<SpriteRenderer>().color = new Color(0.5f, 0.5f, 0.5f, 1);
21 }
22 }
23
24 public override void OnCheckUp()
25 {
26 if (InputController.Name == InputNames.MAINMENU)
27 {
28 transform.localScale = new Vector3(1, 1, transform.localPosition.z);
29 gameObject.GetComponent<SpriteRenderer>().color = new Color(1, 1, 1, 1);
30 }
31 }
32
33 public override void OnTouchUp()
34 {
35 if (InputController.Name == InputNames.MAINMENU)
36 {
37 SoundManager.playButtonSound();
38 switch (buttonIndex)
39 {
40 case 0://more game
41
42 Application.OpenURL("http://google.com"); // LINK MORE GAME
43 break;
44 case 1://setting
45 //GoogleMobileAdControll.AdmobControll.ShowInterstitial();
46 settingLayer.setVisibled(true, true);
47 //InputController.Name = InputNames.SETTING;
48 InputController.Name = InputNames.DIALOG;
49 break;
50 }
51 }
52 }
53 }
54 }
2 using System.Collections;
3 using Settings;
4
5 namespace MainMenu
6 {
7 public class ButtonClickListener : InputAdapter
8 {
9 public int buttonIndex;
10
11 public SettingLayer settingLayer;
12
13 public GameObject achievementLayer;
14
15 public override void OnTouchDown()
16 {
17 if (InputController.Name == InputNames.MAINMENU)
18 {
19 transform.localScale = new Vector3(0.9f, 0.9f, transform.localPosition.z);
20 gameObject.GetComponent<SpriteRenderer>().color = new Color(0.5f, 0.5f, 0.5f, 1);
21 }
22 }
23
24 public override void OnCheckUp()
25 {
26 if (InputController.Name == InputNames.MAINMENU)
27 {
28 transform.localScale = new Vector3(1, 1, transform.localPosition.z);
29 gameObject.GetComponent<SpriteRenderer>().color = new Color(1, 1, 1, 1);
30 }
31 }
32
33 public override void OnTouchUp()
34 {
35 if (InputController.Name == InputNames.MAINMENU)
36 {
37 SoundManager.playButtonSound();
38 switch (buttonIndex)
39 {
40 case 0://more game
41
42 Application.OpenURL("http://google.com"); // LINK MORE GAME
43 break;
44 case 1://setting
45 //GoogleMobileAdControll.AdmobControll.ShowInterstitial();
46 settingLayer.setVisibled(true, true);
47 //InputController.Name = InputNames.SETTING;
48 InputController.Name = InputNames.DIALOG;
49 break;
50 }
51 }
52 }
53 }
54 }
case 0:more game
Application.OpenURL("http:google.com"); LINK MORE GAME
case 1:setting
GoogleMobileAdControll.AdmobControll.ShowInterstitial();
InputController.Name = InputNames.SETTING;